﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace BambolettaDB
{
    public class FilterBaseVM: BaseVM
    {
        #region Properties and Fields
        private string _Target;
        public string Target
        {
            get { return _Target; }
            set { _Target = value; NotifyPropertyChanged("Target"); }
        }

        private string _Value;
        public string Value
        {
            get { return _Value; }
            set { _Value = value; NotifyPropertyChanged("Value"); }
        }
        #endregion

        #region Commands
        private DelegateCommand _DeleteCommand;
        public ICommand DeleteCommand
        {
            get { return _DeleteCommand; }
        }
        public void DeleteExecuted(object parameter)
        {
            MainVM main = MainVM.GetInstance();
            if (main != null)
            {
                main.Filters.Remove(this);
            }
        }
        #endregion

        #region Constructor
        public FilterBaseVM()
        {
            _DeleteCommand = new DelegateCommand(new Action<object>(DeleteExecuted));
        }
        #endregion

        #region Public methods
        public virtual bool Evaluate(RequestVM item)
        {
            return true;
        }

        public bool CompareStrings(string first, string second)
        {
            return string.Equals(first, second, StringComparison.CurrentCultureIgnoreCase);
        }
        #endregion
    }
}
